//
//  clsCategory.m
//  AntsExpress
//
//  Created by slccper on 16/1/6.
//  Copyright © 2016年 slccper. All rights reserved.
//

#import "clsCategory.h"
#import "clsOtherFun.h"
@implementation clsCategory


+(NSMutableArray *) GetDataByArr:(NSArray *) dataList{
    NSMutableArray *WebDataArray=[NSMutableArray array];
    
    for (NSObject * data in dataList) {
        if(![data isKindOfClass:[NSDictionary class]]){
            break;
        }
        NSDictionary *obj=(NSDictionary *)data;
        clsCategory *objinstance=[[clsCategory alloc] init];
        for (int i=0; i<obj.allKeys.count; i++) {
            if ([objinstance respondsToSelector: [clsOtherFun selectorForColumnName:obj.allKeys[i]]]) {
                [clsOtherFun ObjectSetValue:objinstance :obj.allKeys[i] :obj.allValues[i]];
            }
        }
        [WebDataArray addObject:objinstance ];
    }
    NSArray *arr1 = [[NSArray alloc]initWithArray:WebDataArray];
    NSArray *sortedArray = [arr1 sortedArrayUsingSelector:@selector(comparePerson:)];
    WebDataArray = [NSMutableArray arrayWithArray:sortedArray];
    return WebDataArray;
}
+(NSMutableArray *)sortByList:(NSMutableArray *)list
{
    NSMutableArray *arr = [NSMutableArray array];
   
    return arr;
}
-(NSComparisonResult)comparePerson:(clsCategory *)person{
    NSDateFormatter* formater = [[NSDateFormatter alloc] init];
    [formater setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate* date = [formater dateFromString:person.Ddate];
    NSDate* date1 = [formater dateFromString:self.Ddate];
    NSComparisonResult result = [date compare:date1];
//    if (result == NSOrderedSame) {
//        result = [self.isQuhuoTime compare:person.isQuhuoTime];
//    }
    return result;
}
@end
